package br.com.async.agilequiz.domain;

import java.io.Serializable;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

@DatabaseTable(tableName = "answeredQuestion")
public class AnsweredQuestion implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@DatabaseField(foreign=true, foreignAutoCreate = true, foreignAutoRefresh = true)
	private Question question;
	
	@DatabaseField(foreign=true, foreignAutoCreate = true, foreignAutoRefresh = true)
	private Location location;
	
	
	public AnsweredQuestion() {
		
	}


	public Question getQuestion() {
		return question;
	}


	public void setQuestion(Question question) {
		this.question = question;
	}


	public Location getLocation() {
		return location;
	}


	public void setLocation(Location location) {
		this.location = location;
	}


	public static long getSerialversionuid() {
		return serialVersionUID;
	}


	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((location == null) ? 0 : location.hashCode());
		result = prime * result
				+ ((question == null) ? 0 : question.hashCode());
		return result;
	}


	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		AnsweredQuestion other = (AnsweredQuestion) obj;
		if (location == null) {
			if (other.location != null)
				return false;
		} else if (!location.equals(other.location))
			return false;
		if (question == null) {
			if (other.question != null)
				return false;
		} else if (!question.equals(other.question))
			return false;
		return true;
	}
	
	
}
